home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / termsorc.lha / Extras / Source / gtlayout-source.lha / LT_GetMenuItem.c < prev    next >
C/C++ Source or Header  |  1995-09-24  |  720b  |  38 lines

  1. /*  GadTools layout toolkit
  2. **
  3. **  Copyright © 1993-1995 by Olaf `Olsen' Barthel
  4. **  Freely distributable.
  5. **
  6. **  :ts=4
  7. */
  8.  
  9. #include "gtlayout_global.h"
  10.  
  11. #ifdef DO_MENUS
  12.  
  13.     /* LT_GetMenuItem(struct Menu *Menu,ULONG ID):
  14.      *
  15.      *    Obtain the menu item associated with the ID.
  16.      */
  17.  
  18. struct MenuItem * LIBENT
  19. LT_GetMenuItem(REG(a0) struct Menu *Menu,REG(d0) ULONG ID)
  20. {
  21.     RootMenu *Root = (RootMenu *)((ULONG)Menu - offsetof(RootMenu,Menu));
  22.     ItemNode *Item;
  23.  
  24.         // Run down the list...
  25.  
  26.     for(Item = (ItemNode *)Root -> ItemList . mlh_Head ; Item -> Node . mln_Succ ; Item = (ItemNode *)Item -> Node . mln_Succ)
  27.     {
  28.         if(Item -> ID == ID)
  29.             return(&Item -> Item);
  30.     }
  31.  
  32.         // Nothing found
  33.  
  34.     return(NULL);
  35. }
  36.  
  37. #endif    /* DO_MENUS */
  38.